# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-pytest-twisted
pkgver=1.14.0
pkgrel=2
pkgdesc='A twisted plugin for py.test'
arch=('any')
license=('BSD')
url='https://github.com/pytest-dev/pytest-twisted'
depends=('python-pytest' 'python-greenlet' 'python-decorator' 'python-twisted')
makedepends=('python-setuptools')
source=("https://github.com/pytest-dev/pytest-twisted/archive/v$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('d3c1b7320f87bd32bec992b807baf235c13e5595c93895eb7df91f709d7ab92dbbc30a47f4341477d7ba9541958efa1d4ef7d355023050747b401bb541314bc9')

build() {
  cd pytest-twisted-$pkgver
  python setup.py build
}

check() {
  # Hack entry points by installing it

  cd pytest-twisted-$pkgver
  python setup.py install --root="$PWD/tmp_install" --optimize=1
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  PYTHONPATH="$PWD/tmp_install/${site_packages}:$PYTHONPATH" py.test
}

package() {
  cd pytest-twisted-$pkgver
  python setup.py install --root="$pkgdir" --optimize=1
}
